import os
from langchain.chat_models import init_chat_model

os.environ["OPENAI_API_KEY"] = os.getenv("BAOCLOUD_DS_API_KEY")
base_url = os.getenv("BAOCLOUD_DS_BASE_URL")
print(f"base_url = {base_url}")

model = init_chat_model(model="DeepSeek-V3", model_provider="openai", base_url=base_url)

for chunk in model.stream("请讲一个冷笑话"):
    print(chunk.text(), end="")
